//
//  CategoryCollectionViewCell.m
//  muscleLife
//
//  Created by xalo on 16/4/30.
//  Copyright © 2016年 HeavenAndHell. All rights reserved.
//

#import "CategoryCollectionViewCell.h"

@implementation CategoryCollectionViewCell

-(void)setCellWithModel:(CategoryInfoModel *)model index:(NSInteger)index{

    self.cellLabel.text = model.name;
    ImageManager *imageManager=[[ImageManager alloc]init];
    [imageManager searchDishesFilefinished:^(NSArray *imageArr) {

        AVObject* object = [imageArr objectAtIndex:index];
        AVFile* file = [object objectForKey:@"Image"];
        [file getDataInBackgroundWithBlock:^(NSData *data, NSError *error) {

            UIImage *image = [UIImage imageWithData:data];
            self.cellImageView.image = image;
        }];
    }];

}

-(void)setCellWithModel:(CategoryInfoModel *)model index:(NSInteger)index imageName:(NSString *)imageName{
    
    self.cellLabel.text = model.name;
    UIImage* image = [UIImage imageNamed:[NSString stringWithFormat:@"%@%ld",imageName,index]];
    self.cellImageView.image = image;
}
-(void)awakeFromNib{
    
    self.cellImageView.layer.cornerRadius=25;
    self.cellImageView.layer.masksToBounds=YES;
}
@end
